0f913b72ea35dc7d79dc8956f5055489c216539d
[openwrt/openwrt.git] /
1 From ae49493f172e0e5443f1d032ed8ec715eb65f1a2 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mcanal@igalia.com>
3 Date: Mon, 23 Sep 2024 10:55:07 -0300
4 Subject: [PATCH] drm/v3d: Fix return if scheduler initialization fails
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Commit 56cf76ed784fe5347c9305f7f0f3d0f9cb8d8a3b upstream
10
11 If the scheduler initialization fails, GEM initialization must fail as
12 well. Therefore, if `v3d_sched_init()` fails, free the DMA memory
13 allocated and return the error value in `v3d_gem_init()`.
14
15 Signed-off-by: MaĆ­ra Canal <mcanal@igalia.com>
16 Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
17 Link: https://patchwork.freedesktop.org/patch/msgid/20240923141348.2422499-4-mcanal@igalia.com
18 ---
19 drivers/gpu/drm/v3d/v3d_gem.c | 3 ++-
20 1 file changed, 2 insertions(+), 1 deletion(-)
21
22 --- a/drivers/gpu/drm/v3d/v3d_gem.c
23 +++ b/drivers/gpu/drm/v3d/v3d_gem.c
24 @@ -294,8 +294,9 @@ v3d_gem_init(struct drm_device *dev)
25 ret = v3d_sched_init(v3d);
26 if (ret) {
27 drm_mm_takedown(&v3d->mm);
28 - dma_free_coherent(v3d->drm.dev, 4096 * 1024, (void *)v3d->pt,
29 + dma_free_coherent(v3d->drm.dev, pt_size, (void *)v3d->pt,
30 v3d->pt_paddr);
31 + return ret;
32 }
33
34 return 0;